<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //定义变量
        {
            var a = 1;
            let b = 2;
            //let b =222; error
            b = 222;
        }
        console.log(a);
        console.log(b);  //b is not defined, let 定义变量的作用域是当前的代码块内{}

        var m = 1;
        var m = 2;
        let n = 100;
        //let n = 200;   error
        n = 200;
        console.log(m);
        console.log(n);  // Uncaught SyntaxError: Identifier 'n' has already been declared  let对一个变量只能定义一次

        

    </script>
</body>
</html>